package ch.usi.inf.pf2.editor;

import ch.usi.inf.pf2.Sheet;
import ch.usi.inf.pf2.cell.Cell;
import junit.framework.TestCase;
/**
 * 
 * @author Lorenzo Baracchi <lorenzo.baracchi@usi.ch>
 *
 */
public class TestCut extends TestCase
{
    private Sheet s;
    private Cell c;
    private Cut ct;
    
    protected void setUp ()
    {
	   s=new Sheet();
	   s.initializeSheet();
	   c=s.getCell(1, 1);
	   c.setContent("hello");
	   ct = new Cut(s, 1, 1);
    }
    
    public void testEvaluate ()
    {
	   ct.evaluate();
	   assertEquals("hello", ct.getOldText());
	   assertEquals("", ct.getNewText());
	   assertEquals("", c.getContent().toString());
    }
    
    public void testRestore ()
    {
	   ct.evaluate();
	   ct.restore();
	   assertEquals("hello", ct.getOldText());
	   assertEquals("", ct.getNewText());
	   assertEquals("hello", c.getContent().toString());
    }   
}
